// 统一管理项目接口地址
import axios from "@/request/request";
import qs from 'qs';

// 获取精品推荐的数据
export const JingpinAPI = () => axios.get('/products/recommend')

// 获取热门数据
export const HotAPI = () => axios.get('/products/hot')

// 发送短信验证码 params = {}
export const SendSMSAPI = (params) => axios.post("/sendSMS", qs.stringify(params))


// 登录请求
export const PhoneReginAPI = (params) => axios.post("/phoneRegin", qs.stringify(params))

    
// 微信扫描登录
export const weiXinLoginAPI = (params) => axios.post("/wechatUsers/PCLogin", qs.stringify(params))

    
//手机绑定微信
export const BinddingAPI = (params) => axios.post("/wechatUsers/binding", qs.stringify(params))

// console.log('序列化:', qs.stringify({
//     a: 10,
//     b: 100
// }));

//获取用户信息
export const UserProfilesAPI = () => axios.get('/shop/userProfiles')

//商品详情
export const GoodsDetailsAPI = (params) => axios.get(`/products/${params}`)

//加入购物车
export const AddToCarAPI = (params) => axios.post("/shop/carts/add", qs.stringify(params))

//商品搜索（含首页的“更多”）
export const GoodsSearchApi = (params) => axios.get(`/products`, { params })

//查看购物车
export const CartDataApi = () => axios.get(`/shop/carts`)

//购物车删除商品
export const CartDelApi = (id) => axios.delete(`/shop/carts?productIds=${id}`);